package com.dsl.dao;

import com.dsl.entity.LoginTicket;
import org.apache.ibatis.annotations.*;

/**
 * @Description 登陆凭证数据层接口
 * @Author dsl
 * @Date 2024/9/5 下午2:02
 * @Version 1.0
 */
@Mapper
@Deprecated//所注解的类不推荐使用
public interface LoginTicketMapper {

    @Insert("insert into login_ticket(user_id, ticket, status, expired) " +
            "values(#{userId}, #{ticket}, #{status}, #{expired})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int addLoginTicket(LoginTicket loginTicket);

    @Select("select id, user_id, ticket, status, expired " +
            "from login_ticket where ticket=#{ticket}")
    LoginTicket getByTicket(String ticket);

    @Update("update login_ticket set status=#{status} where ticket=#{ticket}")
    int updateStatus(String ticket, int status);
}
